#include <remez_exp.h>
#include <iostream>

using namespace mpfr;

extern void my_exp_coeffs_v1(bool debug);
extern void my_exp_coeffs_v2(bool debug);
extern void my_exp_coeffs_v3(bool debug);
extern void my_exp_coeffs_v4(bool debug);
extern void my_exp_coeffs_v5(bool debug);

int main(int argc, char* argv[])
{


    if (argc <2 )
    {
        std::cout << argv[0] << " 1\nor\n"
                  << argv[0] << " 2\nor\n"
                  << argv[0] << " 3\nor\n"
                  << argv[0] << " 4\nor\n"
                  << argv[0] << " 5\n";
        return 1;
    }

    // 检查命令行参数，
    int mode= atoi( argv[1]);

    if (mode==1)
        my_exp_coeffs_v1(true);
    else if (mode==2)
        my_exp_coeffs_v2(true);
    else if (mode==3)
        my_exp_coeffs_v3(true);
    else if (mode==4)
        my_exp_coeffs_v4(true);
    else if (mode==5)
        my_exp_coeffs_v5(true);
    else
        std::cout << "Error: mode=" << mode << " is not supported\n";
    return 0;
}
/*
 运行结果：
v1: exp(x)的Remez近似多项式系数 (x ∈ [-0.00270761,0.00270761]
    C0 = 1.0000000000000000000171013579411730
    C1 = 1.0000000000000000000146583067761690
    C2 = 0.4999999999999580113317076647134593
    C3 = 0.1666666666666540034175642630056476
    C4 = 0.0416666819398589745940878598721105
    C5 = 0.0083333362425128052522717020460354
    max(error)= 1.7101359e-20

v2: exp(x)的Remez近似多项式系数 (x ∈ [-0.00270761,0.00270761])
    C0 = 1.0
    C1 = 1.0000000000000000000112258035789583
    C2 = 0.4999999999999678437254515924663138
    C3 = 0.1666666666666552372523592190363665
    C4 = 0.0416666808432930432178558174251957
    C5 = 0.0083333361380779564483213034873581
    max(error)=2.10556160e-20

v3: exp(x)的Remez近似多项式系数 (x ∈ [-0.00270761,0.00270761]
    C0 = 1.00
    C1 = 1.00
    C2 = 0.4999999999999678475773689815894736
    C3 = 0.1666666666666588604545019030700414
    C4 = 0.0416666808427005153548860243625152
    C5 = 0.0083333358527262326643806201825266
    max(error)=2.10590e-20

v4: exp(x)的Remez近似多项式系数 (x ∈ [0,0.00541521]
    C0 = 0.9999999999999999999828522742909391
    C1 = 1.0000000000000002279646694875643681
    C2 = 0.4999999999995089360472388269970205
    C3 = 0.1666666670535088692190357349911896
    C4 = 0.0416665289339055680325209502558257
    C5 = 0.0083559302091520783584489479775211
    max(error)=1.71477e-20

v5: exp(x)的Remez近似多项式系数 (x ∈ [0,0.00541521]
    C0 = 1.0
    C1 = 1.0
    C2 = 0.5
    C3 = 0.1666666667563876885313924940441920
    C4 = 0.0416665969635050692215652662272981
    C5 = 0.0083506570406799743127911743349753
    max(error)=7.16439-20
*/